"Orients a sprite to face (or turn away from) the mouse pointer, even if the sprite is moving." & RETURN & RETURN & \
"You can choose whether the sprite always turns to face the mouse, or only when the mouse button is up or down. " & \
"When the mouse is in the other state, the will either return to its initial position, or remain in the position it was in when the mouse state changed." & RETURN & RETURN & \
"The graphic member is considered to face right when it is at rest." & RETURN & RETURN & \
"* Whether to turn toward or away from the mouse" & RETURN & \
"* When to turn (always, while mouse is up, or while mouse is down)" & RETURN & \
"* Whether to return to initial position or remain in new position"
end getBehaviorDescription
on getBehaviorTooltip me
return \
"Use with bitmap, Flash and vector shape members." & RETURN & RETURN & \
"Orients a sprite to face towards or away from the mouse pointer, even if the sprite is moving." & RETURN & RETURN & \
"You can make the sprite face the mouse at all times, or only when the mouse is up or down. " & \
"When the mouse is in the other state, the sprite can either revert to its original postion, or remain in the position it was in when the mouse state changed. " & \
"The member is considered to face right at rest."
end getBehaviorTooltip
-- NOTES FOR DEVELOPERS --
-- The main handler is Turn me. This simply caclulates the difference
-- between the loc of the sprite and the mouseLoc. It then asks the custom
-- GetAngle function to convert this into an angle expressed in degrees.
-- GetAngle will return an angle of zero if the mySpriteToFace is on a
-- horizontal line to the right of mySprite. The angle increases clockwise.
-- Director 7 treats trigonometry in radians and sprite rotation in degrees.
-- Turn me is only called if the behavior is active. Just when this is
-- is determined by the myActivePeriod parameter. In order to make the
-- choices clear in the getPropertyDescriptionList handler,
-- myActivePeriod is initially in the form of a string. A string is slow to
-- handle, and the data it contains will need to be consulted on every
-- prepareFrame. In order to optimize performance, the strings are
-- converted to symbols in the Initialize handler. Symbols are simply
-- integers disguised as a single word. They are thus both fast and
-- expressive.
-- The Activate handler first tests if the mouse has been either clicked or
-- released, and then runs through a 'case' statement to return a TRUE | FALSE
-- value depending on the mouse's current state. IF the value returned is
-- TRUE, then the Turn will be called.
-- HISTORY --
-- 14 September 1998: written for the D7 Behaviors Palette by James Newton
-- 3 November 1998: descriptions improved
-- 7 January 2000: isOkToAttach added J.Powers | String Keys
-- PROPERTIES --
property mySprite -- error checking
property getPDLError -- author-defined parameters
property myOrientation -- TRUE if sprite turns away from mouse